﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Client.Sys
{
    public class ParamObject
    {
        private string p;
        private string p2;
        public string FieldName { get; set; }
        public string Operator { get; set; }
        public object value { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="FieldName"></param>
        /// <param name="Operator"></param>
        /// <param name="value"></param>
        public ParamObject(string _FieldName, string _Operator, object _value)
        {
            // TODO: Complete member initialization
            this.FieldName = _FieldName;
            this.Operator = _Operator;
            this.value = _value;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="FieldName">Ex 'EmployeeID'</param>
        /// <param name="value"></param>
        public ParamObject(string _FieldName, object _value)
        {
            // TODO: Complete member initialization
            this.FieldName = _FieldName;
            this.value = _value;
        }


        public string XMLElement
        {
            get
            {
                if (!string.IsNullOrEmpty(Operator))
                {
                    return "<" + FieldName + @" o=""" + Operator + @""" v=""" + HttpContext.Current.Server.HtmlEncode(value.ToString()) + @"""/>";
                }
                else
                {
                    return "<" + FieldName + @" v=""" + HttpContext.Current.Server.HtmlEncode(value.ToString()) + @"""/>";
                }
            }
        }
    }
}
